import React, { Component, ReactNode } from "react"
import { ActivityIndicator } from "antd-mobile"
import "antd-mobile/dist/antd-mobile.css"
import "./loading.less"

interface LoadingProps {
  animating?: boolean | undefined //显隐状态
  size?: "small" | "large" | undefined //spinner大小，可选small/large
  toast?: boolean //loading样式类型
  text: string //loading文本
  children?: ReactNode
  color?: string //loading的颜色
  className?: string
  loadingWrapClassname?: string
}

export class Loading extends Component<LoadingProps, {}> {
  render() {
    let { loadingWrapClassname } = this.props

    return (
      <div className={`loading-wrap ${loadingWrapClassname}`}>
        <ActivityIndicator {...this.props} />
      </div>
    )
  }
}
